package com.future;

import java.util.PriorityQueue;

/**
 * Description: 1531. 压缩字符串 II
 *
 * @author weiruibai.vendor
 * Date: 2022/11/10 14:51
 */
public class Solution_1531 {

    static Solution_1531 instance = new Solution_1531();

    public static void main(String[] args) {
        String s = "aaabcccd";
        int k = 2;
        System.out.println(instance.getLengthOfOptimalCompression(s, k));
    }

    /**
     * 待完成
     *
     * @param s
     * @param k
     * @return
     */
    public int getLengthOfOptimalCompression(String s, int k) {
        if (s.length() < 2) {
            return s.length();
        }
        int N = s.length();
        char[] chars = s.toCharArray();
        PriorityQueue<Integer> queue = new PriorityQueue<>();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < N; ) {
            sb.append(chars[i]);
            int count = 1;
            int j = i + 1;
            while (j < N && chars[i] == chars[j]) {
                count++;
                j++;
            }
            i = j;
            queue.add(count);
            if (count != 1) {
                sb.append(count);
            }
        }
        while (k != 0 && !queue.isEmpty()) {
            Integer peek = queue.peek();
            if (peek == 1 || peek % 10 == 0) {

            }
        }
        return 0;
    }
}
